<style scoped>
	div{
		width          :300px;
		height         :300px;
		display        : flex;
		justify-content: center;
		align-items    : center;
	}

	.focus{
		background: #f3e38d;
	}

	.splash{
		background: #b1e4fb;
	}
</style>
<template lang="pug">
	div(
		@click="click()"
		v-bind:class="{ focus: type==0, splash: type==1 }"
	)
		h1 广告{{ type+1 }}
</template>
<script>
	const axios = require('axios').create()

	const urls = [
		'https://test.qiang7.cn/api/extra/ads/70055b9c4676ff41/focus',
		'https://test.qiang7.cn/api/extra/ads/6fd1959793905916/focus/track',
		'https://test.qiang7.cn/api/extra/ads/4ed5d7f813149222/splash',
		'https://test.qiang7.cn/api/extra/ads/27b5af147b857ee7/splash/track',
		'https://test.qiang7.cn/api/extra/ads/46822bb2ad8bca0d/focus',
		'https://test.qiang7.cn/api/extra/ads/e7df96970b956b58/focus/track',
		'https://test.qiang7.cn/api/extra/ads/7aecfaf5db39a660/splash',
		'https://test.qiang7.cn/api/extra/ads/7482e8ff7eedcd34/splash/track',
		'https://test.qiang7.cn/api/extra/ads/fe29ad06097ece87/focus',
		'https://test.qiang7.cn/api/extra/ads/0fed6d6d70487e78/focus/track',
		'https://test.qiang7.cn/api/extra/ads/3fe4e691cbbf6cc2/splash',
		'https://test.qiang7.cn/api/extra/ads/f1f85fb6d858b9d3/splash/track',
		'https://test.qiang7.cn/api/extra/ads/139a9b7a4d100657/focus',
		'https://test.qiang7.cn/api/extra/ads/8901acc2d43644f9/focus/track',
		'https://test.qiang7.cn/api/extra/ads/c15711e7866fd397/splash',
		'https://test.qiang7.cn/api/extra/ads/bfe10e8556a82c5e/splash/track',
		'https://test.qiang7.cn/api/extra/ads/405136ba499ce121/focus',
		'https://test.qiang7.cn/api/extra/ads/e4536b3d411be7c8/focus/track',
		'https://test.qiang7.cn/api/extra/ads/7a1abc4054531ce7/splash',
		'https://test.qiang7.cn/api/extra/ads/c75fe32bdf5ffecd/splash/track'
	]

	module.exports = {
		data () {
			return {
				type: undefined,
				num : undefined,
			}
		},
		mounted () {
			this.type = ({focus : 0, splash: 1})[this.$route.query.type]
			this.num  = this.$route.query.num


			axios.get(
				urls[ this.num*4 + this.type*2 ]
			)
		},

		methods: {
			click () {
				axios.get(
					urls[ this.num*4 + this.type*2 + 1 ]
				)
			}
		}
	}
</script>
